home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-02-24 | 6.3 KB | 240 lines |
- 10 'CW - 5 SEP 87 rev. 24 FEB 97
- 20 CLS:KEY OFF
- 30 IF EX$=""THEN EX$="EXIT"
- 40 COLOR 7,0,1
- 50 UL$=STRING$(80,205)
- 60 X$=STRING$(79,32)
- 70 DIM C$(90,3)
- 80 GOTO 260
- 90 '
- 100 RESTORE
- 110 FOR Z=42 TO 90:C$(Z,1)=CHR$(Z):READ Z$:C$(Z,2)=" "+Z$
- 120 IF Z$="*"THEN D$="p10":GOTO 210
- 130 L=LEN(Z$):D$=""
- 140 FOR X=1 TO L
- 150 M$=MID$(Z$,X,1)
- 160 IF M$="."THEN N$=K$+"30p30"
- 170 IF M$="-"THEN N$=K$+"10p30"
- 180 D$=D$+N$
- 190 NEXT X
- 200 L=LEN(D$)-1:MID$(D$,L,1)="1"
- 210 C$(Z,3)=D$
- 220 NEXT Z
- 230 C$(42,1)="END":C$(45,1)="<UNK! {00F7}>"
- 240 RETURN
- 250 '
- 260 CLS
- 270 COLOR 15,2,1
- 280 PRINT " MORSE CODE TRAINER";TAB(57)"by George Murphy VE3ERP ";
- 290 COLOR 1,0:PRINT STRING$(80,223);
- 300 COLOR 7,0
- 310 GOSUB 1730
- 320 PRINT UL$;
- 330 PRINT " Press letter in < > to:"
- 340 PRINT UL$;
- 350 PRINT " <c> Copy code in key of C (523 Hz)"
- 360 PRINT " <d> Copy code in key of D (587 Hz)"
- 370 PRINT " <e> Copy code in key of E (659 Hz)"
- 380 PRINT " <f> Copy code in key of F (698 Hz)"
- 390 PRINT " <g> Copy code in key of G (784 Hz)"
- 400 PRINT " <h> Display Morse Code Character Set"
- 410 PRINT
- 420 PRINT " <z> EXIT";
- 430 K$=INKEY$:IF K$=""THEN 430
- 440 GOSUB 100
- 450 IF K$="z"THEN CLS:RUN EX$
- 460 Z=ASC(K$):IF Z>98 AND Z<105 THEN 490
- 470 GOTO 430
- 480 '
- 490 '.....start
- 500 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 510 IF K$="h"THEN 1420
- 520 GOSUB 1970
- 530 PRINT UL$;
- 540 FOR Z=1 TO 9:PRINT TAB(8)"<";Z;"> EQV";
- 550 PRINT USING"###.# WPM";2.5+2.5*Z:NEXT Z
- 560 PRINT TAB(5)"or < 0 > to EXIT...."
- 570 Z$=INKEY$:IF Z$=""THEN 570 ELSE S=ASC(Z$)
- 580 IF Z$="0"THEN CLS:END
- 590 IF S<48 OR S>57 THEN 570 ELSE S=S-48
- 600 SP=2.5*(S+1):S$=STR$(25*(S+1)):PLAY"MLO3t"+S$
- 610 CLS:PRINT " Press number in < > to:
- 620 PRINT UL$;
- 630 PRINT " <1> Copy a message or series of characters"
- 640 PRINT " <2> Copy random 5-character groups"
- 650 PRINT " <3> Learn Morse characters"
- 660 Z$=INKEY$
- 670 IF Z$="1"THEN 720
- 680 IF Z$="2"THEN 890
- 690 IF Z$="3"THEN 1580
- 700 GOTO 660
- 710 '
- 720 '.....send characters
- 730 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 740 PRINT
- 750 PRINT " ENTER MESSAGE (no commas please!) or ENTER <0> to return to Menu"
- 760 PRINT
- 770 INPUT Z$
- 780 IF Z$="0"THEN 260
- 790 CLS:COLOR 7,0,0
- 800 FOR Z=1 TO LEN(Z$)
- 810 Y=ASC(MID$(Z$,Z)):IF Y>96 AND Y<123 THEN Y=Y-32
- 820 PLAY C$(Y,3)
- 830 PRINT CHR$(Y);
- 840 NEXT Z:PRINT ""
- 850 PRINT UL$;
- 860 PRINT " Speed selected: about";SP;"WPM."
- 870 GOTO 1240
- 880 '
- 890 '.....generate groups
- 900 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 910 INPUT " How many of 5-character groups ......";N
- 920 DIM A$(N*5+1)
- 930 CLS:COLOR 7,0,0
- 940 RANDOMIZE TIMER
- 950 LOCATE 12,27:PRINT "Sending group # 1 of";N
- 960 T1=TIMER
- 970 '
- 980 FOR Z=1 TO N*5
- 990 Y=INT(RND*100)
- 1000 IF Y<44 OR Y>90 THEN Z=Z-1:GOTO 1050
- 1010 IF Y>57 AND Y<65 THEN Z=Z-1:GOTO 1050
- 1020 PLAY C$(Y,3):A$(Z)=C$(Y,1)
- 1030 IF Z/5=INT(Z/5)THEN PLAY"p5"
- 1040 LOCATE 12,43:PRINT USING "###";INT(1+(Z/5))
- 1050 NEXT Z
- 1060 CLS:LOCATE 12,33:PRINT ".....END....."
- 1070 '
- 1080 T2=TIMER:T=T2-T1:W=N/T*60
- 1090 PLAY"p3":PLAY C$(42,3)
- 1100 CLS:PRINT "This is what you just heard (<UNK! {00F7}> is a pause -...-):"
- 1110 PRINT UL$;
- 1120 FOR I=1 TO Z:PRINT A$(I);
- 1130 IF I/5=INT(I/5)THEN PRINT " ";
- 1140 NEXT I:PRINT UL$;
- 1150 PRINT " Speed selected: about";SP;"WPM."
- 1160 TT=(T2-T1)/60
- 1170 PRINT " Transmission time:";USING "##.### minutes";TT
- 1180 PRINT " Actual speed (military standard) was";N;
- 1190 PRINT "cipher groups in";USING "####.#";T;
- 1200 PRINT " sec.=";TAB(72);USING "###.#";W;
- 1210 PRINT " WPM";
- 1220 ERASE A$:GOTO 1240
- 1230 '
- 1240 '.....ARRL standard speed
- 1250 COLOR 0,7:PRINT " Computing dots per minute.....Please Wait....."
- 1260 LN=CSRLIN-1
- 1270 PLAY"MLO6t"+S$
- 1280 TW1=TIMER+5:N=0 'set timer cutout at 5 seconds
- 1290 N=N+1:PLAY "g30p30p30":LOCATE LN,48:PRINT 60-N
- 1300 IF TIMER>TW1 THEN TW2=TIMER:COLOR 7,0:GOTO 1320
- 1310 GOTO 1290
- 1320 DS=N/5 'dots per second
- 1330 NW=2.4*DS 'words per minute
- 1340 LOCATE CSRLIN-1
- 1350 PRINT " Actual speed (A.R.R.L. standard) was";
- 1360 PRINT USING"####.#";N*12;
- 1370 PRINT" dots per minute <UNK! {00F6}> 25 =";TAB(72);USING "###.#";NW;
- 1380 PRINT " WPM";
- 1390 PRINT UL$;
- 1400 GOTO 2170
- 1410 '
- 1420 '.....morse characters
- 1430 PRINT " MORSE CODE CHARACTER SET: (<UNK! {00F7}>) -...- denotes a pause."
- 1440 PRINT " "+STRING$(25,205)
- 1450 PRINT " ("+C$(63,1)+")";C$(63,2),
- 1460 FOR Z=44 TO 90
- 1470 IF Z>57 AND Z<65 THEN 1500
- 1480 IF C$(Z,1)=" *"THEN 1500
- 1490 PRINT " ("+C$(Z,1)+")";C$(Z,2),
- 1500 NEXT Z
- 1510 PRINT " "+C$(42,1);C$(42,2)
- 1520 PRINT
- 1530 PRINT " There are several other Morse characters, but these are the ones";
- 1540 PRINT " most commonly"
- 1550 PRINT " in amateur radio communication."
- 1560 GOTO 2170
- 1570 '
- 1580 '.....learn characters
- 1590 CLS:RANDOMIZE TIMER
- 1600 PRINT " Press 1 to copy a character or 0 to QUIT"
- 1610 Z$=INKEY$:IF Z$=""THEN 1610
- 1620 IF Z$="0"THEN 260
- 1630 IF Z$="1"THEN 1640 ELSE 1610
- 1640 LOCATE CSRLIN-1:PRINT X$:LOCATE CSRLIN-1
- 1650 Y=INT(RND*100):IF Y<44 OR Y>90 THEN 1650
- 1660 IF Y>57 AND Y<65 THEN 1650
- 1670 PLAY C$(Y,3):PRINT" Press 2 to see what you heard"
- 1680 IF INKEY$="2"THEN 1690 ELSE 1680
- 1690 LOCATE CSRLIN-1:PRINT X$:LOCATE CSRLIN-1
- 1700 PRINT " "+C$(Y,1)+" "+C$(Y,2)
- 1710 GOTO 1600
- 1720 '
- 1730 '.....preface
- 1740 T=7
- 1750 PRINT TAB(T);
- 1760 PRINT "This program will help you learn to copy Morse code by the British"
- 1770 PRINT TAB(T);
- 1780 PRINT "Military System. The Military sent EVERYTHING in 5-character cipher"
- 1790 PRINT TAB(T);
- 1800 PRINT "groups. Wireless operators had no way of knowing the meaning of the"
- 1810 PRINT TAB(T);
- 1820 PRINT "message, or even what language it was in. They were required ONLY"
- 1830 PRINT TAB(T);
- 1840 PRINT "to copy each character EXACTLY. There was no point in anticipating"
- 1850 PRINT TAB(T);
- 1860 PRINT "the next character or guessing one that had been missed because"
- 1870 PRINT TAB(T);
- 1880 PRINT "they could be anything. There may be easier ways to learn CW and"
- 1890 PRINT TAB(T);
- 1900 PRINT "some may even teach you how to remember it after passing some"
- 1910 PRINT TAB(T);
- 1920 PRINT "required test, but as any CW buff who learned by the Military"
- 1930 PRINT TAB(T);
- 1940 PRINT "Method will attest, once you learn it this way you never forget it."
- 1950 RETURN
- 1960 '
- 1970 '.....speed note
- 1980 T=8
- 1990 PRINT TAB(T);
- 2000 PRINT "Code speeds in this program are set in accordance with military"
- 2010 PRINT TAB(T);
- 2020 PRINT "standards whereby all messages are sent in 5-character encoded"
- 2030 PRINT TAB(T);
- 2040 PRINT "cipher groups with each cipher group logged as one word. This is a"
- 2050 PRINT TAB(T);
- 2060 PRINT "close approximation of plain English language where in normal"
- 2070 PRINT TAB(T);
- 2080 PRINT "usage the average word length is 5 letters. Speeds are also shown"
- 2090 PRINT TAB(T);
- 2100 PRINT "in WPM according to the A.R.R.L. dots-per-minute standard."
- 2110 PRINT UL$;
- 2120 PRINT " Current speed level is set at <";:COLOR 15,6:PRINT S;
- 2130 COLOR 7,0:PRINT ">"
- 2140 PRINT " To set speed level for next exercise press number in < > for:"
- 2150 RETURN
- 2160 '
- 2170 '.....end
- 2180 GOSUB 2270:CLS:GOTO 260
- 2190 '
- 2200 DATA .-.-.,*,--..--,-...-,.-.-.-,-..-.,-----
- 2210 DATA .----,..---,...--,....-,.....,-....,--...
- 2220 DATA ---..,----.,*,*,*,*,*,..--..,*,.-,-...
- 2230 DATA -.-.,-..,.,..-.,--.,....,..,.---,-.-,.-..
- 2240 DATA --,-.,---,.--.,--.-,.-.,...,-,..-,...-
- 2250 DATA .--,-..-,-.--,--..
- 2260 '
- 2270 'HARDCOPY
- 2280 GOSUB 2390:LOCATE 25,2:COLOR 14,6
- 2290 PRINT " Press 1 to print screen, 2 to print screen & ";
- 2300 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 2310 Z$=INKEY$:IF Z$="3"THEN GOSUB 2390:RETURN
- 2320 IF Z$="1"OR Z$="2"THEN GOSUB 2390:GOTO 2340
- 2330 GOTO 2310
- 2340 FOR QX=1 TO 24:FOR QY=1 TO 80
- 2350 LPRINT CHR$(SCREEN(QX,QY));
- 2360 NEXT QY:NEXT QX
- 2370 IF Z$="2"THEN LPRINT CHR$(12)
- 2380 GOTO 2280
- 2390 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-